<template>
  <div class="home-new">
    <HomePanel title="人气推荐" subTitle="人气爆款 不容错过">
      <ul class="goods-list">
        <li v-for="item in list" :key="item.id">
          <img :src="item.picture" alt="" />
          <p class="name ellipsis">{{ item.title }}</p>
          <p class="price">{{ item.alt }}</p>
        </li>
      </ul>
    </HomePanel>
  </div>
</template>

<script>
import { getHotlist } from '@/api/home.js'
import HomePanel from './HomePanel.vue'
import { ref } from 'vue'
export default {
  components: {
    HomePanel
  },
  setup() {
    const list = ref([])
    getHotlist().then(res => {
      console.log(res)
      list.value = res.result
    })
    return { list }
  }
}
</script>

<style scoped lang="less">
.goods-list {
  display: flex;
  justify-content: space-between;
  height: 406px;
  li {
    width: 306px;
    height: 406px;
    background: #f0f9f4;
    .hoverShadow();
    img {
      width: 306px;
      height: 306px;
    }
    p {
      font-size: 22px;
      padding: 12px 30px 0 30px;
      text-align: center;
    }
    .price {
      color: @priceColor;
    }
  }
}
</style>
